package com.ysh.controller;


import com.ysh.pojo.CrimesDto;
import com.ysh.pojo.R;
import com.ysh.service.CrimesService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author :  嚴嚴嚴
 * @data : 2023/12/11  16:01
 * @Email : ysh00618@163.com
 * @Description :
 */

@RestController
@RequestMapping("/api/crime")
public class CrimeController {

    @Resource
    private CrimesService crimeServiceImpl;

    /**
     * - 按年份统计每年风险指数最高的3个城市
     *
     * @return
     */
    @GetMapping("/stat")
    public R risk() {
        return crimeServiceImpl.risk();
    }



    @PostMapping
    public R add(@RequestBody CrimesDto crimes){


      return crimeServiceImpl.add(crimes);


    }
}
